;(function () {
    // 初始化年份数据
    $('#order-count').text(num2thousand(order.year.count));
    $('#sale').text(num2thousand(order.year.sale));

    // 绑定点击切换事件
    $('.total-wrapper .title').on('click', '.btn', function () {
        $(this).addClass('active').siblings('.btn').removeClass('active');
        const id = $(this).attr('id');
        $('#order-count').text(num2thousand(order[id].count));
        $('#sale').text(num2thousand(order[id].sale));    
    });

    // 轮播
    let currentIndex = 1;
    setInterval(function () {
        $('.total-wrapper .title .btn').eq(currentIndex % 4).trigger('click');
        currentIndex++;
    }, 1000);

})();
